package com.wy.OneClient.pojo;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 吴宇~
 * @motto 我亦无他，唯手熟尔。
 * @edition jdk1.8
 * @reflection 0-1 喧闹任其喧闹，自由我自为之，我自风情万种，与世无争。
 * @date 2024/03/03/21:17
 * @target 心若有所向往，何惧道阻且长
 */
public class Message implements Serializable {
    private static final long serialVersionUID = 1L;
    private User user;
    private AddressInfo addressInfo;
//    这部分应该是使用数据对象还是，在这儿使用一个泛型，好像是 封装一个好
    private Data data;


    public Message() {
        this.user = new User();
        this.addressInfo = new AddressInfo();
        this.data =  new Data<String>(null, DataType.STRING);
    }

    public Message(User user, AddressInfo addressInfo, Data data) {
        this.user = user;
        this.addressInfo = addressInfo;
        this.data = data;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public AddressInfo getAddressInfo() {
        return addressInfo;
    }

    public void setAddressInfo(AddressInfo addressInfo) {
        this.addressInfo = addressInfo;
    }

    public Data getData() {
        return data;
    }

    public void setData(Data data) {
        this.data = data;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Message message = (Message) o;
        return Objects.equals(user, message.user) &&
                Objects.equals(addressInfo, message.addressInfo) &&
                Objects.equals(data, message.data);
    }

    @Override
    public int hashCode() {
        return Objects.hash(user, addressInfo, data);
    }

    @Override
    public String toString() {
        return "Message{" +
                "user=" + user +
                ", addressInfo=" + addressInfo +
                ", data=" + data +
                '}';
    }
}
